package com.yunxin.core.utils.infra.common.constant;

import java.util.StringJoiner;

/**
 * @author zero°
 * @since 2023-06-05
 */
public enum RedisConstants {


    /**
     * 实列
     */
    INSTANCE;

    private static final String REDIS_KEY_SEPARATOR = ":";

    public static final String SMS_CAPTCHA = "sms_captcha";
    //渠道配置前缀
    public static final String CHANNEL_CAPTCHA = "channel_captcha";
    // 企业微信前缀
    public static final String  ABUTMENT_TYPE = "abutment_type";
    public static final String  BE_ABUTMENT_TYPE = "be_abutment_type";

    public static final String YXY_ORDER_KEY = "yxy_order_key";

    public static final String UV_ORDER_KEY = "uv_order_key";

    public static final String YXY_PRODUCT_KEY = "yxy_product_key";

    public static final String YXY_INSTITUTIONNAMES_KEY = "yxy_institutionNames_key";

    public static final Long REDIS_CAPTCHA_OVER_TIME = 60L;

    /**
     * 短信验证码 超时时间
     */
    public static final Integer CAPTCHA_TIMEOUT = -5;


    public static final String UV_LIMIT_KEY = "uv:limit";

    /**
     * 多个部分拼接Redis的键
     *
     * @param parts parts
     * @return String
     */
    public  String of(String... parts) {
        StringJoiner joiner = new StringJoiner(REDIS_KEY_SEPARATOR);
        for (String part : parts) {
            joiner.add(part);
        }
        return joiner.toString();
    }
}
